from src.database.connection import Neo4jInstance

graph = Neo4jInstance.get_connect()

# # 过滤目前需要的ifc类型，后面可以删除
# def filter_ifc_type(nodes: []) -> []:
#     need_type = [
#         "IfcBuilding",
#         "IfcBuildingStorey",
#         "IfcColumn",
#         "IfcBeam",
#         "IfcSlab",
#     ]  # 目前只考虑柱、梁、楼板
#     ret = [node for node in nodes if node["type"] in need_type]
#     return ret


# 目前只保留这几种构件  IfcBuilding , IfcBuildingStorey , IfcColumn , IfcBeam , IfcSlab
def clean_not_need_type():
    graph.run(
        """
    MATCH (n) where  not ( n.type in [
        'IfcBuilding',
        'IfcBuildingStorey',
        'IfcColumn',
        'IfcBeam',
        'IfcSlab'
        ]) return n
    """
    )
